/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package izsla.beans;

import izsla.entities.TripUser;
import javax.faces.context.FacesContext;

/**
 * Helps to retrive the user from a Bean.
 */
public class SessionHelper {
    /**
     * Get the current user.
     * @return the logged in user, or null if the user is not logged in.
     */
    public static TripUser getUser() {
	try {
	    return (TripUser)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("user");
	}
	catch(Exception e) {
	}

	return null;
    }
}
